<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2021.3.22
 * Time: 9:52
 */

function sum($carry,$item) {
    $carry += $item;
    return $carry;
}

$a = array(1,2,3,4,5);
$res = array_reduce($a,'sum');
